<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<base href="<%=basePath%>">
		<meta charset="utf-8" />
		<title></title>
		<meta name="description" content="overview & stats" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<link rel="stylesheet" href="static/css/bootstrap.min.css" />
		<link rel="stylesheet" href="static/css/bootstrap-responsive.min.css" />
		<link rel="stylesheet" href="static/css/font-awesome.min.css" />
		<link rel="stylesheet" href="static/css/chosen.css" />
		<link rel="stylesheet" href="static/css/ace.min.css" />
		<link rel="stylesheet" href="static/css/ace-responsive.min.css" />
		<link rel="stylesheet" href="static/css/ace-skins.min.css" />
		<link rel="stylesheet" href="static/css/date/bootstrap-datetimepicker.css" /><!-- 日期框 -->
		<link rel="stylesheet" href="static/css/date/bootstrap-datetimepicker.min.css" /><!-- 日期框 -->
	</head>
<body>
	<div id="centerOfMainFrame">
			<!-- 检索  -->
			<form action="weixinmsg/goViewPromotionMsg.do" method="post" name="wxpomotionmsgForm" id="wxpomotionmsgForm">
			<input type="hidden" name="promotion_id" id="promotion_id" value="${pageData.promotion_id }"/>
			<table id="table_report" class="table table-striped table-bordered table-hover">
				<thead>
					<tr>
						<th>序号</th>
						<th>推广ID</th>
						<th>标题</th>
						<th>内容</th>
						<th>图片</th>
						<th>链接地址</th>
						<th>消息类型</th>
						<th>消息状态</th>
						<th class="center">操作</th>
					</tr>
				</thead>
										
				<tbody>
				<!-- 开始循环 -->	
				<c:choose>
					<c:when test="${not empty varList}">
						<c:forEach items="${varList}" var="var" varStatus="vs">
							<tr>
								<td class='center' style="width: 30px;">${vs.index+1}</td>
								<td>${var.promotion_id }</td>
								<td>${var.articles_title }</td>
								<td>${var.content }</td>
								<td>
									<c:if test="${var.pic_url != '' && var.pic_url != null }">
										<a href="http://chatapp3.oss-cn-hangzhou.aliyuncs.com/${var.pic_url}" target="_blank"><img src="http://chatapp3.oss-cn-hangzhou.aliyuncs.com/${var.pic_url}" width="50" /></a>
									</c:if>
								</td>
								<td>${var.link_url }</td>
								<td>
									<c:if test="${var.msg_type == 1 }">文本</c:if>
									<c:if test="${var.msg_type == 2 }">图文</c:if>
								</td>
								<td>
									<c:if test="${var.msg_status == 1 }"><font color="green">有效</font></c:if>
									<c:if test="${var.msg_status == 0 }"><font color="red">无效</font></c:if>
								</td>
								<td style="width: 60px;" class="center">
									<div class='hidden-phone visible-desktop btn-group'>
										<a class='btn btn-mini btn-info' title="编辑" onclick="edit('${var.id }');"><i class='icon-edit'></i></a>
									</div>
								</td>
							</tr>
						</c:forEach>
					</c:when>
					<c:otherwise>
						<tr class="main_info">
							<td colspan="11" class="center" >没有相关数据</td>
						</tr>
					</c:otherwise>
				</c:choose>
				</tbody>
			</table>
			
		<div class="page-header position-relative">
			<table style="width:100%;">
				<tr>
					<td style="vertical-align:top;">
						<a class="btn btn-small btn-success" onclick="addWeixinPomotionMsg(${pageData.promotion_id });">新增回复消息</a>
					</td>
					<td style="vertical-align:top;"><div class="pagination" style="float: right;padding-top: 0px;margin-top: 0px;">${page.pageStr}</div></td>
				</tr>
			</table>
		</div>
		</form>
	</div>
	
	<!-- 引入 -->
	<script type="text/javascript">window.jQuery || document.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");</script>
	<script type="text/javascript" src="static/js/date/jquery-1.8.3.min.js" charset="UTF-8"></script>
	<script type="text/javascript" src="static/js/jquery.tips.js"></script>
	<script type="text/javascript" src="static/js/ace-elements.min.js"></script>
	<script type="text/javascript" src="static/js/ace.min.js"></script>
	<script type="text/javascript" src="static/js/chosen.jquery.min.js"></script><!-- 单选框 -->
	<script type="text/javascript" src="static/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="static/js/date/bootstrap-datetimepicker.js" charset="UTF-8"></script>
	<script type="text/javascript" src="static/js/date/bootstrap-datetimepicker.zh-CN.js"></script><!-- 日期框 -->
	<script type="text/javascript" src="static/js/bootbox.min.js"></script><!-- 确认窗口 -->
	<script type="text/javascript">
	$(top.hangge());
	
	function addWeixinPomotionMsg(promotion_id){
		 top.jzts();
		 var diag = new top.Dialog();
		 diag.Drag=true;
		 diag.Title ="新增回复消息";
		 diag.URL = '<%=basePath%>/weixinmsg/goAddWeixinPomotionMsg.do?promotion_id=' + promotion_id;
		 diag.Width = 850;
		 diag.Height = 580;
		 diag.CancelEvent = function(){ //关闭事件
			 if(diag.innerFrame.contentWindow.document.getElementById('centerOfMainFrame').style.display == 'none'){
				 if('${page.currentPage}' == '0'){
					 top.jzts();
					 setTimeout("self.location.reload()",100);
				 }else{
					 nextPage(${page.currentPage});
				 }
			}
			diag.close();
		 };
		 diag.show();
	}
	
	function edit(msg_id){
		 top.jzts();
		 var diag = new top.Dialog();
		 diag.Drag=true;
		 diag.Title ="编辑消息";
		 diag.URL = '<%=basePath%>/weixinmsg/goEditWeixinPomotionMsg.do?msg_id=' + msg_id;
		 diag.Width = 850;
		 diag.Height = 580;
		 diag.CancelEvent = function(){ //关闭事件
			 if(diag.innerFrame.contentWindow.document.getElementById('centerOfMainFrame').style.display == 'none'){
				 if('${page.currentPage}' == '0'){
					 top.jzts();
					 setTimeout("self.location.reload()",100);
				 }else{
					 nextPage(${page.currentPage});
				 }
			}
			diag.close();
		 };
		 diag.show();
	}
	</script>
</body>
</html>